<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8" />
    <title>{notempty name="title"}{$title}{/notempty}</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" href="/static/tpamis/amis-sdk/sdk.css" />
    <link rel="stylesheet" href="/static/tpamis/amis-sdk/helper.css" />
    <link rel="stylesheet" href="/static/tpamis/amis-sdk/iconfont.css" />

    <!-- Stylesheets -->
    <!-- Page JS Plugins CSS -->

    {notempty name="extend_css_list"}
    {volist name="extend_css_list" id="css"}
    <link rel="stylesheet" href="{$css}?v={:time()}">
    {/volist}
    {/notempty}


    <style>
        html,
        body,
        .app-wrapper {
            position: relative;
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }
    </style>
    {notempty name="page_style"}
    <style>     
    {php} echo arrayToCsses($page_style); {/php}    
    {/notempty}

</style>
    {block name="page_style"}{/block}
</head>

<body>
    <div id="root" class="app-wrapper"></div>
    <script src="/static/tpamis/amis-sdk/sdk.js"></script>

    <!-- Page JS Plugins -->

    {notempty name="extend_js_list"}
    {volist name="extend_js_list" id="js"}
    <script src="{$js}?v={:time()}"></script>
    {/volist}
    {/notempty}

    <script type="text/javascript">
        (function () {
            window.enableAMISDebug = true;
            let amis = amisRequire('amis/embed');

            {notempty name="extend_js_script"}
            {volist name="extend_js_script" id="script"}
            {$script}
            {/volist}
            {/notempty}

            // 通过替换下面这个配置来生成不同页面
            let amisJSON = {:json_encode($amisJSON, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE)};
            let amisScoped = amis.embed('#root', amisJSON);
            let scrollHeight = document.body.scrollHeight - 10;
            window.parent.postMessage(
                {
                    type: 'amis:resize',
                    data: {
                        height: scrollHeight
                    }
                },
                '*'
            );
        })();
    </script>
</body>

</html>